import sys
from copy import deepcopy

class QuartoBoard:
    def __init__(self):
		self.spots = [None] * 4
		for i in range(4):
			self.spots[i] = [None] * 4
            
    def placePiece(self,piece,x,y):
        if not self.spots[x][y]:
            self.spots[x][y] = deepcopy(piece)
            return True
        return False
			
    def displayBoard(self):
		i = 0
		while i<=13:
			sys.stdout.write("-")
			i +=1
		
		y = 11
		while y >= 0:
			print ""
			x = 0
			while x <= 12:
				if y%3 == 0:
					sys.stdout.write("-")
				else:
					spot_x = x/3
					spot_y = y/3
					if x%3 == 0:
						sys.stdout.write("|")
					elif self.spots[spot_x][spot_y]:
						if x%3 == 1 and y%3 == 2:
							attr = 0
						elif x%3 == 2 and y%3 == 2:
							attr = 1
						elif x%3 == 1 and y%3 == 1:
							attr = 2
						else:
							attr = 3
						sys.stdout.write(self.spots[spot_x][spot_y].attributes[attr])
					else:
						sys.stdout.write(" ")
				x += 1
			y -= 1
			
	

		